-
Notifications
You must be signed in to change notification settings - Fork 268
Adding ESP32 support and fix for ESP32 v 1.0.2 #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Adding ESP32 support in Ethernet 2.0.0 library. Especially for ESP32 v1.0.2
public: | ||
EthernetServer(uint16_t port) : _port(port) { } | ||
EthernetClient available(); | ||
EthernetClient accept(); | ||
// 20190421 https://kmpelectronics.eu/ Plamen Kovandjiev - We added support for ESP32. | ||
#ifdef ESP32 | ||
virtual void begin(uint16_t port = 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related: #88
It seems like it would be better for the ESP32 core developers to follow the standard Arduino core API, rather than forcing every library to be patched to deal with the breakage they caused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, the ESP folks appear to have strayed from the Arduino API. Not good.
src/Ethernet.h
Outdated
@@ -219,6 +219,11 @@ class EthernetClient : public Client { | |||
uint8_t status(); | |||
virtual int connect(IPAddress ip, uint16_t port); | |||
virtual int connect(const char *host, uint16_t port); | |||
// 20190421 https://kmpelectronics.eu/ Plamen Kovandjiev - We added support for ESP32. | |||
#ifdef ESP32 | |||
virtual int connect(IPAddress ip, uint16_t port, int timeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a mechanism for setting the timeout:
https://www.arduino.cc/en/Reference/EthernetClientSetConnectionTimeout
my comment there espressif/arduino-esp32@9a9ff62#commitcomment-33292990 the PR should be closed, not be merged |
Dear @JAndrassy |
the ESP32 package should be fixed. they should not change the Arduino API classes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The need to have special declarations of EthernetClient::connect()
for ESP32 was removed by espressif/arduino-esp32#3191.
Unfortunately, the situation with EthernetServer::begin()
remains.
I don't know what the story is with EthernetServer::init()
. @kmpelectronics, please provide an explanation regarding the need for this.
I don't like the "mark my territory" comments. You will be given credit for your contribution in the commit history and you are welcome to add your name to the AUTHORS file in this PR if you like. I think it's a bad idea to clutter up the code with this stuff though. Imagine what a mess the source files would be if everyone who touched these files had done that over the years!
The method |
|
Where is the problem with |
sorry. yes. I mixed it. And what should be server.init()? EthernetServer has a constructor. init() is usually for additional initialisation of objects instanced in a library. |
I have removed EthernetClient::connect() specific method for ESP32 and renamed from |
@kmpelectronics, port is specified in constructor. The ESP32 core changed Arduino API |
OK, I will close this PR. But you should know this library does not work together with ESP32. |
We have added ESP32 support in Ethernet 2.0.0 library. Especially for ESP32
v1.0.2.
You can delete our comments where they are necessary.